<template>
	<view class="">
		<view class="title">钟山区({{allTotal}})
		<span class="title1">{{label}}</span>
		</view>		
		<liu-folding-panel :dataList="dataList" @change="change"></liu-folding-panel>
		
		
	</view>
</template>

<script>
	import api from "../../api/routes.js";
	export default{
		data(){
			return{
				type:'',				
				dataList: [],
				index:'',
				allTotal:'',
				label:"",
				
			}
		},
	    async onLoad(e) {
			console.log(e.index,'******');
			this.index=e.index;
			this.allTotal=e.allTotal;
			this.label=e.label;
			
			if(e.index=='allTotal'){
				uni.setNavigationBarTitle({
					title:'劳动力总数'
									
				})
			}else if(e.index=='notUpdate'){
				uni.setNavigationBarTitle({
					title:'未更新台账'
									
				})
			}else if(e.index=='aryUpdate'){
				uni.setNavigationBarTitle({
					title:'已更新台账'
									
				})
			}else if(e.index=='todayUpdate'){
				uni.setNavigationBarTitle({
					title:'今日更新台账'
									
				})
			}else if(e.index=='allTotal1'){
				uni.setNavigationBarTitle({
					title:'劳动力总数'
									
				})
			}else if(e.index=='notUpdate1'){
				uni.setNavigationBarTitle({
					title:'未更新劳动力台帐'
									
				})
			}else if(e.index=='aryUpdate1'){
				uni.setNavigationBarTitle({
					title:'已更新劳动力台帐'
									
				})
			}else if(e.index=='todayUpdate1'){
				uni.setNavigationBarTitle({
					title:'今日更新劳动力台帐'
									
				})
			}
			
			const res =await this.$myRequest({
				url: api.queryRegion,
				method: "GET",
				data: {	
					type:e.index,
				},
				
			});
			console.log(e.index,'e.index');
			this.dataList=res.data.list.map(s=>{
				return{
					id:s.deptId,
					total:s.total,
					name:s.dept + "("+s.total+")",
					childs:s.deptCountList.map(n=>{
						return{
							id:n.deptId,
							total:n.total,
							name:n.dept  + "("+n.total+")",
						}
						
					})
					
				}
			})
			console.log(res,'*****9999');
			console.log(this.dataList,'***444444');
			
			
			
		},
		methods:{
			change(e) {
				console.log('点击二级信息:' + JSON.stringify(e))
				console.log('点击33信息:' ,e)
				uni.navigateTo({
				    url: "/pages/humanSociety/userInformation?addressName="+e.name+"&type="+this.index+'&id='+e.id,
				});
			},
			 
		}
	}
</script>

<style lang="scss" scoped>
	.title{
		font-size: 18px;
		font-weight: bold;
		height: 40px;
		line-height: 40px;
		padding: 10px;
		.title1{
			float: right;
			color: red;
			font-size: 14px;
		}
	}
</style>